package com.maolong.deadpro.controller;

import com.maolong.deadpro.config.RabbitConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class DeadTest {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/dead")
    public String dead(@RequestParam String id){
        CorrelationData correlationData=new CorrelationData();
        log.info("发送消息id:{}",id);
        rabbitTemplate.convertAndSend("normal_exchange","normal.xinxi",id,correlationData);
        return "ok";
    }
}
